home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / movement / Apple.lua next >
Text File  |  2009-09-05  |  1KB  |  43 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Apple
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, September 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.apple={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.apple.gfx_wpn=loadgfx("weapons/apple.bmp")                            -- Weapon Image
  13. setmidhandle(cc.apple.gfx_wpn)
  14. cc.apple.sfx_eat=loadsfx("eat.ogg")                                        -- Eat Sound
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: Apple
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.apple.id=addweapon("cc.apple","Apple",cc.apple.gfx_wpn,0,0)            -- Add Weapon (0 uses)
  21.  
  22. function cc.apple.draw()                                                -- Draw
  23.     if (weapon_shots==0) then
  24.         setblend(blend_alpha)
  25.         setalpha(1)
  26.         setcolor(255,255,255)
  27.         drawinhand(cc.apple.gfx_wpn,8,2,0.6)
  28.     end
  29. end
  30.  
  31. function cc.apple.attack(attack)                                        -- Attack
  32.     if (weapon_shots<=0) then
  33.         if (attack==1) then
  34.             -- Use weapon and allow to use another one afterwards (1)
  35.             useweapon(1)
  36.             weapon_shots=weapon_shots+1
  37.             -- Heal
  38.             playerheal(0,15)
  39.             -- Effect
  40.             playsound(cc.apple.sfx_eat)
  41.         end
  42.     end
  43. end